package com.mi9688.lambda;

import java.util.Arrays;
import java.util.Comparator;
import java.util.List;

public class Test04 {
	public static void main(String [] args){
		List<Student> students1=Arrays.asList(new Student("小明",18),new Student("小黑",16),new Student("小红",17));
		List<Student> students2=Arrays.asList(new Student("小明",18),new Student("小黑",16),new Student("小红",17));

		students1.sort(new Comparator<Student>(){

			@Override
			public int compare(Student stu1, Student stu2) {
				return stu1.getAge()- stu2.getAge();
			}});

		//Lambda
		students2.sort((stu1,stu2)->stu1.getAge()-stu2.getAge());
		
		
		
		
		System.out.println(students1);
		System.out.println(students2);
		
		
	}
}
